<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title> 小程序管理系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black"> 
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">
  
  <link rel="stylesheet" href="/Public/layui/css/layui.css"  media="all">
  <style type="text/css">
  .layui-table{
    text-align: center;
  }
  .layui-table td, .layui-table th{
    text-align: center;
  }
  </style>
</head>
<body>
<div class="layui-layout layui-layout-admin">
  <div class="layui-header">
    <div class="layui-logo">借书小程序</div>
    <!-- 头部区域（可配合layui已有的水平导航） -->
    <ul class="layui-nav layui-layout-left">
      <li class="layui-nav-item"><a href="<?php echo U('Index/index');?>">首页</a></li>
      <li class="layui-nav-item layui-this"><a href="<?php echo U('Member/index');?>">用户管理</a></li>
    </ul>
    <ul class="layui-nav layui-layout-right">

      <li class="layui-nav-item">
        <a href="javascript:;">
          <img src="<?php echo (session('headimgurl')); ?>" class="layui-nav-img">
          <?php echo (session('nickname')); ?>
        </a>
        <dl class="layui-nav-child">
          <dd><a href="<?php echo U('Home/Public/logout');?>">退出登录</a></dd>
          <!-- <dd><a href="">安全设置</a></dd> -->
        </dl>
      </li>
    </ul>
  </div>

  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul class="layui-nav layui-nav-tree"  lay-filter="test">
        <li class="layui-nav-item layui-this"><a href="<?php echo U('Member/index');?>">用户管理</a></li>
        <li class="layui-nav-item"><a href="<?php echo U('MemberBlack/index');?>">黑名单管理</a></li>
      </ul>
    </div>
  </div>
  
  <div class="layui-body">
    <!-- 内容主体区域 -->
    <div style="padding:0 15px;">
      <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>用户管理</legend>
      </fieldset>
      <table class="layui-table">
        <colgroup>
          <col width="100">
        </colgroup>
        <thead>
          <tr>
            <th>ID</th>
            <th>用户名</th>
            <th>首次使用时间</th>
            <th>最近登录时间</th>
            <th>操作</th>
          </tr> 
        </thead>
        <tbody>
          <?php if(is_array($list)): foreach($list as $key=>$vo): ?><tr>
            <td><?php echo ($vo["mid"]); ?></td>
            <td><img class="layui-nav-img" src="<?php echo ($vo["headimgurl"]); ?>"> <?php echo ($vo["nickname"]); ?></td>
            <td><?php echo ($vo["create_time"]); ?></td>
            <td><?php echo ($vo["last_time"]); ?></td>
            <td>
              <?php if($vo['is_tui'] == 1): ?><button data-id="<?php echo ($vo["mid"]); ?>" data-status="0"  class="tui1 layui-btn layui-btn-small">取消推荐</button>
                <?php else: ?>
                <button data-id="<?php echo ($vo["mid"]); ?>" data-status="1"  class="tui1 layui-btn layui-btn-small">推荐</button><?php endif; ?>
              <button class="layui-btn layui-btn-small">加入黑名单</button>
            </td>
          </tr><?php endforeach; endif; ?>
        </tbody>
      </table>
      <div id="page-box"></div>
    </div>
  </div>
  
  <div class="layui-footer">
    <!-- 底部固定区域 -->
    © 2017-2018 <a href="https://www.58zltc.com" target="_blank">  </a> All Rights Reserved.
  </div>
</div>
<script src="/Public/layui/layui.js" charset="utf-8"></script>
<script src="/Public/js/jquery-1.11.1.min.js" charset="utf-8"></script>
<script>
//JavaScript代码区域
layui.use(['element','laypage'], function(){
  var element = layui.element
          ,$ = layui.jquery
          ,layer = layui.layer
          ,laypage = layui.laypage;


  $(".tui1").click( function(event) {
    var id = $(this).data('id');
    var status = $(this).data('status');
    var content = $(this).data('content');
    $.post("<?php echo U('tui');?>", {id: id, status: status }, function(e) {
      if(e.status == 1){
        layer.msg(e.info,{icon: 6,time:1000});
        setTimeout("location.reload()",1000);
      }else{
        layer.msg(e.info,{icon:1,time:1000});
      }
    });
  });

  laypage.render({
    elem: 'page-box'
    ,count: 0
    ,layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
    ,jump: function(obj){
      console.log(obj)
    }
  });  
});
</script>
</body>
</html>